home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / rcs55.zip / FREEZE.SH < prev    next >
Text File  |  1991-09-15  |  3KB  |  112 lines

  1. # freeze - assign a symbolic revision number to a configuration of RCS files
  2.  
  3. #       The idea is to run freeze each time a new version is checked
  4. #       in. A unique symbolic revision name is then assigned to the most
  5. #       recent revision of each RCS file of the main trunk.
  6. #
  7. #       A log message is requested from the user which is saved for future
  8. #       references.
  9. #
  10. #       The shell script works only on all RCS files at one time.
  11. #       It is important that all changed files are checked in (there are
  12. #       no precautions against any error in this respect).
  13.  
  14. # Check whether we have an RCS subdirectory, so we can have the right
  15. # prefix for our paths.
  16.  
  17. test -d RCS
  18. if ($status == 0) then
  19.     set RCSDIR=RCS
  20. else
  21.     set RCSDIR=.
  22. endif
  23.  
  24. # Version number stuff, log message file
  25. set VERSIONFILE=$RCSDIR/freeze.ver
  26. set LOGFILE=$RCSDIR/freeze.log
  27.  
  28. # Initialize, if freeze never run before in the current directory
  29.  
  30. test -r $VERSIONFILE
  31. if ($status '!=' 0) then
  32.     echo 0 > $VERSIONFILE
  33.     echo >> $LOGFILE
  34. endif
  35.  
  36.  
  37. # Get Version number, increase it, write back to file.
  38. cp $VERSIONFILE ./frztemp
  39. set VER=$`frztemp`
  40. @ VER = $VER + 1
  41. echo $VER > $VERSIONFILE
  42.  
  43. # Symbolic Revision Number
  44. set SYMREVNAME=$1
  45.  
  46. # Allow the user to give a meaningful symbolic name to the revision.
  47.  
  48. if (strcmp(,$1) == 0) then
  49.     echo "Error: Symbolic name needed for configuration"
  50.     echo
  51.     echo "Usage: freeze name"
  52.     echo
  53.     echo "Freezes the current configuration by applying the symbol name"
  54.     echo "to the latest revision on each file"
  55.     echo
  56.     exit 1
  57. endif
  58.  
  59. # Stamp the logfile. Because we order the logfile the most recent
  60. # first we will have to save everything right now in a temporary file.
  61.  
  62. set TMPLOG=frzxxxxx
  63.  
  64. echo $SYMREVNAME : $d $t > $TMPLOG
  65.  
  66. # Now ask for a log message, continously add to the log file
  67.  
  68. set STOP = 0
  69.  
  70.     echo Version: $SYMREVNAME
  71.     echo "--------" 
  72.     echo "enter description for configuration, terminated with a single '.'"
  73.     while ($STOP '!=' 1)
  74.         echo -n ">> "
  75.         read MESS 
  76.         switch ($MESS)
  77.             case .:
  78.                 set STOP=1
  79.                 echo >> $TMPLOG
  80.                 break;
  81.             default:
  82.                 echo $SYMREVNAME : $MESS >> $TMPLOG
  83.         endsw
  84.      end
  85.  
  86. # combine old and new logfiles
  87. cat $TMPLOG $LOGFILE >frztemp
  88. rm -f $TMPLOG $LOGFILE; mv frztemp $LOGFILE
  89.  
  90. # make the log and version files hidden while we process the RCS files
  91.  
  92. chmod +h $VERSIONFILE $LOGFILE
  93.  
  94. # Now the real work begins by assigning a symbolic revision number
  95. # to each rcs file. Take the most recent version of the main trunk.
  96.  
  97. foreach FILE in ($RCSDIR/*.*)
  98. #   get the revision number of the most recent revision
  99.     rlog -h $FILE | sed -n "s/^head:[ \t]*//p" > frztemp
  100.     set REV=$`frztemp`
  101.  
  102. #    assign symbolic name to it
  103.     echo freeze: $REV $FILE
  104.     rcs -q -n$SYMREVNAME\:$REV $FILE
  105. end
  106.  
  107. # tidy up; delete scratch files and make log and version files visible
  108.  
  109. rm frztemp
  110. chmod -h $LOGFILE $VERSIONFILE
  111. exit 0
  112.